﻿using Blog.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Blog.Controllers
{
    public class HomeController : Controller
    {
        public string name;
        UserEntities db = new UserEntities();
        public ActionResult Index()
        {
            using (UserEntities db = new UserEntities())
            {
                var user = db.Sing.ToList();
                return View(user);
            }
          
        }
       public ActionResult Admin()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }


        public ActionResult Cad(int id)
        {
            var a = db.Reg.SingleOrDefault(r => r.Id == id).Name;
            var aa = db.Reg.SingleOrDefault(r => r.Id == id).Id;
            ViewBag.name = a;
            ViewBag.id = aa;
            return View();
        }
    }
}